﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

namespace HCD.Mdt.Dtos
{
    public class MdtMasterApplyInput : IValidatableObject
    {
        /// <summary>
        /// 病人标识
        /// </summary>
        [Required(AllowEmptyStrings = false,ErrorMessage ="PIdIsRequired")]
        public string PatientId { get; set; }
        /// <summary>
        /// 就诊标识(住院VisitId门诊ClinicNo)
        /// </summary>
        [Required(AllowEmptyStrings =false)]
        public string VisitId { get; set; }
        /// <summary>
        /// 会诊流水号
        /// </summary>
        [Required]
        public string SerialNo { get; set; }
        /// <summary>
        ///  会诊要务
        /// </summary>
        [Required]
        public string Priority { get; set; }
        /// <summary>
        /// 会诊目的
        /// </summary>
        [Required]
        public string Purpose { get; set; }
        /// <summary>
        /// 会诊说明
        /// </summary>
        public string Description { get; set; }
        /// <summary>
        /// 会诊医生/组
        /// </summary>
        public string GroupId { get; set; }
        /// <summary>
        /// 创建人(发起医生Code)
        /// </summary>
        [Required]
        public string CreatedBy { get; set; }
        /// <summary>
        /// 创建人姓名(发起医生)
        /// </summary>
        [Required]
        public string CreatedByName { get; set; }
        /// <summary>
        /// 发起时间
        /// </summary>
        [Required]
        public DateTime CreatedTime { get; set; }

        /// <summary>
        /// 诊疗组类型
        /// </summary>
        public string GroupType { get; set; }

        /// <summary>
        /// 诊疗组名称
        /// </summary>
        public string GroupName { get; set; }

        /// <summary>
        /// 科室代码
        /// </summary>
        public string DeptCode { get; set; }

        /// <summary>
        /// 科室名称
        /// </summary>
        public string DeptName { get; set; }

        /// <summary>
        /// 管理就诊类型（门诊/住院/预入院）
        /// </summary>
        public string ManageType { get; set; }

        /// <summary>
        /// 会诊组参与人集合
        /// </summary>
        public List<MdtGroupUserApplyInput> MdtGroupUserAdds { get; set; }


        public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
        {
            if (MdtGroupUserAdds == null || MdtGroupUserAdds.Count==0)
            {
                yield return new ValidationResult("Required", new string[] { "MdtGroupUserAdds" });
            }
        }
    }

    public class MdtGroupUserApplyInput
    {
        /// <summary>
        /// 医生工号
        /// </summary>
        [Required]
        public string DoctorId { get; set; }

        /// <summary>
        /// 医生姓名
        /// </summary>
        [Required]
        public string DoctorName { get; set; }

        /// <summary>
        /// 医生所属科室名称（行政科室）
        /// </summary>
        [Required]
        public string DoctorDept { get; set; }
    }
}
